package jackson.src.day04;

import java.beans.BeanInfo;
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;

/**
 * Author: JacksonCoder
 * FileName: javaBeanDemo
 * Version: 1.0.0
 */
public class javaBeanDemo {
    // JavaBean主要用来传递数据，即把一组数据组合成一个JavaBean便于传输。
    public static void main(String[] args) throws Exception {
        BeanInfo info = Introspector.getBeanInfo(Human.class);
        for(PropertyDescriptor pd: info.getPropertyDescriptors()){
            System.out.println(pd.getName());
            System.out.println(" " + pd.getReadMethod());
            System.out.println(" " + pd.getWriteMethod());
        }
    }
}

class Human {
    private String name;
    private int age;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
}